home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / win / tkWinPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  2.8 KB  |  118 lines  |  [TEXT/CWIE]

  1. /*
  2.  * tkWinPort.h --
  3.  *
  4.  *    This header file handles porting issues that occur because of
  5.  *    differences between Windows and Unix. It should be the only
  6.  *    file that contains #ifdefs to handle different flavors of OS.
  7.  *
  8.  * Copyright (c) 1995-1996 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkWinPort.h 1.25 97/04/21 17:08:42
  14.  */
  15.  
  16. #ifndef _WINPORT
  17. #define _WINPORT
  18.  
  19. #include <X11/Xlib.h>
  20. #include <X11/cursorfont.h>
  21. #include <X11/keysym.h>
  22. #include <X11/Xatom.h>
  23. #include <X11/Xutil.h>
  24.  
  25. #include <malloc.h>
  26. #include <errno.h>
  27. #include <ctype.h>
  28. #include <math.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31. #include <limits.h>
  32. #include <fcntl.h>
  33. #include <io.h>
  34. #include <sys/stat.h>
  35. #include <time.h>
  36.  
  37. #ifdef _MSC_VER
  38. #    define hypot _hypot
  39. #endif /* _MSC_VER */
  40.  
  41. #define strncasecmp strnicmp
  42. #define strcasecmp stricmp
  43.  
  44. #define NBBY 8
  45.  
  46. #define OPEN_MAX 32
  47.  
  48. /*
  49.  * The following define causes Tk to use its internal keysym hash table
  50.  */
  51.  
  52. #define REDO_KEYSYM_LOOKUP
  53.  
  54. /*
  55.  * The following macro checks to see whether there is buffered
  56.  * input data available for a stdio FILE.
  57.  */
  58.  
  59. #ifdef _MSC_VER
  60. #    define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0)
  61. #else /* _MSC_VER */
  62. #    define TK_READ_DATA_PENDING(f) ((f)->level > 0)
  63. #endif /* _MSC_VER */
  64.  
  65. /*
  66.  * The following stubs implement various calls that don't do anything
  67.  * under Windows.
  68.  */
  69.  
  70. #define TkFreeWindowId(dispPtr,w)
  71. #define TkInitXId(dispPtr)
  72. #define TkpCmapStressed(tkwin,colormap) (0)
  73. #define XFlush(display)
  74. #define XGrabServer(display)
  75. #define XUngrabServer(display)
  76. #define TkpSync(display)
  77.  
  78. /*
  79.  * The following functions are implemented as macros under Windows.
  80.  */
  81.  
  82. #define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
  83. #define XNoOp(display) {display->request++;}
  84. #define XSynchronize(display, bool) {display->request++;}
  85. #define XSync(display, bool) {display->request++;}
  86. #define XVisualIDFromVisual(visual) (visual->visualid)
  87.  
  88. /*
  89.  * The following Tk functions are implemented as macros under Windows.
  90.  */
  91.  
  92. #define TkGetNativeProlog(interp) TkGetProlog(interp)
  93. #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \
  94.     | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000)
  95.  
  96. /*
  97.  * These calls implement native bitmaps which are not currently 
  98.  * supported under Windows.  The macros eliminate the calls.
  99.  */
  100.  
  101. #define TkpDefineNativeBitmaps()
  102. #define TkpCreateNativeBitmap(display, source) None
  103. #define TkpGetNativeAppBitmap(display, name, w, h) None
  104.  
  105. /*
  106.  * Define timezone for gettimeofday.
  107.  */
  108.  
  109. struct timezone {
  110.     int tz_minuteswest;
  111.     int tz_dsttime;
  112. };
  113.  
  114. extern int gettimeofday(struct timeval *, struct timezone *);
  115. EXTERN void        panic _ANSI_ARGS_(TCL_VARARGS(char *,format));
  116.  
  117. #endif /* _WINPORT */
  118.